package com.movitech.mobile.cz.base.modules.controller;

import com.movitech.mobile.cz.base.common.util.CommonConstants;

public class RestReturnResult<T> {

    private String code; //1：成功 2：失败
    private String msg; //成功或错误信息
    private String bussinessId;////成功或错误编号
    private String systemCode;
    private T data; //结果

    public RestReturnResult(String code) {
        this.code = code;
    }
    
    public RestReturnResult(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public RestReturnResult(String code, String bussinessId, String msg) {
        this.code = code;
        this.msg = msg;
        this.bussinessId = bussinessId;
    }
    
    public RestReturnResult(String code,T data, String bussinessId, String msg) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.bussinessId = bussinessId;
    }
    
    public RestReturnResult(String code, T data) {
        this.code = code;
        this.data = data;
    }
    
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public String getBussinessId() {
		return bussinessId;
	}
	public void setBussinessId(String bussinessId) {
		this.bussinessId = bussinessId;
	}
	public String getSystemCode() {
		return systemCode;
	}
	public void setSystemCode(String systemCode) {
		this.systemCode = systemCode;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
    
    public static RestReturnResult error(){
        return new RestReturnResult(CommonConstants.FAIL, "系统错误！");
    }

    public static RestReturnResult success(){
        return new RestReturnResult(CommonConstants.SUCCESS,"操作成功");
    }
}
